package com.tfos.study.ssm.xml.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tfos.study.ssm.xml.entity.Organization;
import com.tfos.study.ssm.xml.mapper.OrganizationMapper;
import com.tfos.study.ssm.xml.service.OrganizationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类功能说明：机构管理接口实现类 <br/>
 * 公司名称：TF（腾飞）开源 <br/>
 * 作者：luorongxi <br/>
 */
@Service
public class OrganizationServiceImpl implements OrganizationService {

    @Resource
    private OrganizationMapper organizationMapper;

    @Override
    public PageInfo<Organization> listForPage(Integer pageNum, Integer pageSize) {
        //在查询之前设置分页,利用Mybatis的分页插件实现分页
        PageHelper.startPage(pageNum, pageSize);
        List<Organization> list = organizationMapper.listAll();
        PageInfo<Organization> info = new PageInfo<>(list);
        return info;
    }

    @Override
    public Organization findById(Integer orgId) {
        return organizationMapper.findById(orgId);
    }
}
